<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Chatu.ControlLider.Web.Models.Domain.EmployeeSummary>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Lista de Empleados
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h2>Lista de Empleados</h2>
    <p>
        <%= Html.ActionLink("Ingresar Nuevo Empleado", MVC.Employee.Create()) %>
    </p>
    <table>
        <tr>
            <th style="width:160px;">Acciones</th>
            <th style="width:90px">
                Cedula
            </th>
            <td style="min-width:200px">
                <b>Apellido, Nombre</b>
            </td>
            <td style="width:150px;">
                <b>Cargo</b>
            </td>
            <td style="width:150px;">
                <b>Tipo de Contrato</b>
            </td>
        </tr>
    <% for (var i = 0; i < Model.Count(); ++i ) {
        var item = Model.ElementAt(i); %>  
    <% if (i % 2 == 0) { %>
        <tr>
    <% } else { %>
        <tr style="background-color:#ECF6FC">
    <% } %>
            <td>
                <%= Html.ActionLink("Modificar", MVC.Employee.Edit(item.Cedula)) %> |
            <% using (Html.BeginForm("Delete", "Employee", FormMethod.Post, new{ style = "display:inline"})) { %>
                <%= Html.Hidden("cedula", item.Cedula) %>
                <input type="submit" onclick="return confirm('Esta seguro de que desea eliminar este empleado?');" value="Eliminar" />
            <% } %>
            </td>
            <td style="text-align:center">
                <%= Html.Encode(item.Cedula) %>
            </td>
            <td>
                <%= Html.Encode(item.FullName) %>
            </td>
            <td>
                <%= Html.Encode(item.JobTitle) %>
            </td>
            <td>
                <%= Html.Encode(item.Type) %>
            </td>
        </tr>
    <% } %>
    </table>
</asp:Content>